import javax.management.MBeanAttributeInfo;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 */



public class Test {
    public static void main(String[] args) {
        boolean flg = true == true ? true == false ? false :true :false;
        System.out.println(flg);
       /* int a = 10;
        int b = 20;
        double c = a > b ? 1.0 : 2;
        System.out.println(c);*/
      //  a > b ? a : b;//err
       /* int c = a > b ? 1.0 :2.0;
        System.out.println(c);//err*/
    }


    public static void main20(String[] args) {
         int a = 10;
         int b = 20;
         int max = a > b ? a : b;//条件运算符
        System.out.println(max);
    }
    public static void main19(String[] args) {
        int a = 11;
        int b = -1;
        System.out.println(a << 1);
        System.out.println(a >> 1);
        System.out.println(b >>> 1);
    }
    public static void main18(String[] args) {
        int a = 10;
        int b = 20;
        System.out.println(a ^ b);//按位异或
        System.out.println(~a);//按位取反
        System.out.println(a | b);//按位或
        System.out.println(a & b);//按位与
    }
    public static void main17(String[] args) {
        int a = 1;
        int b = 2;
        System.out.println(a < b | 10 / 0 == 0);//true | 执行

        //System.out.println(a > b & 10 / 0 == 0);//false & 执行
    }
    public static void main16(String[] args) {
        int a = 1;
        int b = 2;
        System.out.println(a > b && 10 / 0 == 0);//false && 不执行
        System.out.println(a < b || 10 / 0 == 0);//true && 不执行
        /* System.out.println(10 / 0 == 0);*/
    }
    public static void main15(String[] args) {
        int a = 1;
        System.out.println(!(a == 1));//!true 结果 false
        System.out.println(!(a == 3));//!false 结果true
        System.out.println(!(a != 1));//!false 结果true
        System.out.println(!true);//!true 结果 false
        System.out.println(!false);//!false 结果true
    }
    public static void main14(String[] args) {
        int a = 10;
        int b = 20;
        System.out.println(a == 10 || b == 20);// true && true ，结果 true
        System.out.println(a == 10 || b != 20);//true && false ，结果  true
        System.out.println(a > 100 || b == 20);//false && true ，结果  true
        System.out.println(a > 100 || b <20);//false && false ，结果 false
    }
    public static void main13(String[] args) {
        //逻辑与
        int a = 10;
        int b = 20;
        System.out.println(a == 10 && b == 20);// true && true ，结果 true
        System.out.println(a == 10 && b != 20);//true && false ，结果 false
        System.out.println(a > 100 && b == 20);//false && true ，结果 false
        System.out.println(a > 100 && b <20);//false && false ，结果 false

    }
    public static void main12(String[] args) {
        //关系运算符
        int a = 10;
        int b = 20;
        System.out.println(a == b);//false
       /* b = a;//将a的值 赋给 b
        System.out.println(b); //10  */
        System.out.println(a != b);//true
        System.out.println(a < b);//true
        System.out.println(a > b);//false
        System.out.println(a <= b);//true
        System.out.println(a >= b);//false
    }
    public static void main11(String[] args) {
        int a = 10;
        System.out.println(a++);//先+1.后使用
        System.out.println(a);
    }
    public static void main10(String[] args) {
        int a = 10;
        a++;
        System.out.println("后置++的a: "+ a);
       // ++10；//err
    }
    public static void main9(String[] args) {
        int a = 10;
        System.out.println(++a);//先+1.后使用---11
        System.out.println(a);//11
    }
    public static void main8(String[] args) {
        int a = 10;
        ++a;
        System.out.println("前置++的a: "+ a);//11
    }
    public static void main7(String[] args) {
          int c = 10;
        c++;//后置++:先使用，后赋值
        System.out.println("后置++的c: "+ c);
        System.out.println(c++);//先使用c原来的值，表达式结束后c变量 +1
        System.out.println(c);
        int d = c++;
        System.out.println("c = "+c +" "+"d = "+d);
    }
    public static void main6(String[] args) {
        int a = 10;
        ++a;//前置++；先+1.后使用
        System.out.println("前置++的a: "+ a);
        System.out.println(++a);//先+1.后使用
        System.out.println(a);
        int b = ++a;//等价于 a = a + 1 = 12; b = a = 12
        System.out.println("a = " +a +" "+"b = "+b);

    }
    public static void main5(String[] args) {
       /*// 1 += 2;//err
        // 只有变量可以使用运算符
*/
     /*   int a = 10;
        long b = 20L;
        a = a + b;//不兼容的类型: 从long转换到int可能会有损失
        System.out.println(a);
*/
        int a = 10;
        long b = 20L;
        a +=  b;
        System.out.println(a);

    }
    public static void main4(String[] args) {
        int a = 10;
        a = a + 2;
        int b = 10;
        b = b - 2;
        int c = 10;
        c = c * 2;
        int d = 10;
        d =d % 2;
        System.out.println(a +" "+ b+" "+ c+" "+ d);
    }
    public static void main3(String[] args) {
        int a = 10;
        a += 2;
        int b = 10;
        b -= 2;
        int c = 10;
        c *= 2;
        int d = 10;
        d %= 2;
        System.out.println(a +" "+ b+" "+ c+" "+ d);

    }
    public static void main2(String[] args) {
        int a = 30;
        int b = 20;
        System.out.println(a % b);//整型取模
        double c = 40.0;
        double d = 30.0;
        System.out.println(c % d);//double类型取模
    }
    public static void main1(String[] args) {
        int a = 30;
        int b = 20;
        System.out.println(a + b);
        System.out.println(a - b);
        System.out.println(a * b);
        System.out.println(a / b);//向下取整 ，舍弃小数
        System.out.println(a % b);//%求出的是数学除法中的余数
        double c = 40.0;
        double d = 10.0;
        System.out.println(a / b);
        System.out.println(c / b);
        System.out.println(b / c);
        System.out.println(c / d);
        //System.out.println(a / e);
      /*  int a = 30;
        int e = 0;
        System.out.println(a % e);*/

    }
}
